Skip to content

Update theme-compat header and footer#36

Open
sabernhardt wants to merge 8 commits intotrunkfrom
theme-compat
Open

Update theme-compat header and footer#36
sabernhardt wants to merge 8 commits intotrunkfrom
theme-compat

Conversation

@sabernhardt
Copy link
Copy Markdown
Owner

Make the HTML a little better in the fallback templates.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sabernhardt.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

<link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" media="screen" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

<?php if ( file_exists( get_stylesheet_directory() . '/images/kubrickbgwide.jpg' ) ) { ?>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removes (check for) Kubrick background image

<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php echo wp_get_document_title(); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="profile" href="https://gmpg.org/xfn/11" />
Copy link
Copy Markdown
Owner Author

@sabernhardt sabernhardt Jun 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • updates charset meta, from TT1
  • retains the hardcoded title tag, as the theme-compat was intended for older themes
  • adds viewport meta (from TT1)
  • moves XFN profile link down

Comment thread src/wp-includes/theme-compat/header.php Outdated
<title><?php echo wp_get_document_title(); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="profile" href="https://gmpg.org/xfn/11" />
<link rel="stylesheet" href="<?php echo esc_url( get_stylesheet_uri() ); ?>" type="text/css" media="all" />
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stylesheet link uses get_stylesheet_uri function, as Twenty Ten and Twenty Eleven do, and this changes media to all

Comment thread src/wp-includes/theme-compat/header.php Outdated

<?php wp_head(); ?>
if ( is_singular() && pings_open() ) {
echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '" />', "\n";
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks whether pings are open for post before printing (from TT1, but adding self-closing slash and line break)

echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '" />', "\n";
}
if ( is_singular() ) {
wp_enqueue_script( 'comment-reply' );
Copy link
Copy Markdown
Owner Author

@sabernhardt sabernhardt Jun 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retains the comment-reply script, but this checks whether comments are open and threaded before printing the script (as themes since Twenty Twelve have done)

Comment thread src/wp-includes/theme-compat/header.php Outdated
<div id="headerimg">
<h1><a href="<?php echo home_url(); ?>/"><?php bloginfo( 'name' ); ?></a></h1>
<div class="description"><?php bloginfo( 'description' ); ?></div>
<?php if ( ! empty( get_bloginfo( 'name' ) ) ) : ?>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks whether the site has a site title before printing the header (avoiding an empty link and heading)

<?php if ( ! empty( get_bloginfo( 'name' ) ) ) : ?>
<div id="header" role="banner">
<div id="headerimg">
<h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

escapes home_url and adds rel="home" to the link, similar to themes such as Twenty Seventeen

</div>
</div>
<hr />
<hr aria-hidden="true" />
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retains horizontal rule for visual separation, but hides it from screen readers because it has no semantic value

Comment on lines -19 to -37
<hr />
<div id="footer" role="contentinfo">
<!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
<p>
<?php
printf(
/* translators: 1: Site name, 2: WordPress */
__( '%1$s is proudly powered by %2$s' ),
get_bloginfo( 'name' ),
'<a href="https://wordpress.org/">WordPress</a>'
);
?>
</p>
</div>
</div>

<!-- Gorgeous design by Michael Heilemann - http://binarybonsai.com/ -->
<?php /* "Just what do you think you're doing Dave?" */ ?>

Copy link
Copy Markdown
Owner Author

@sabernhardt sabernhardt Jun 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removes horizontal rule, footer, and the design credit (which does not fit the active theme)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trac 50171 did not remove the design credit, but the changes proposed in this PR would remove some vestiges of the Kubrick design.

</head>

<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adds wp_body_open hook

<title><?php echo wp_get_document_title(); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="profile" href="https://gmpg.org/xfn/11" />
<style> :where(#header) { padding-left: 5%; padding-right: 5%; } </style>
Copy link
Copy Markdown
Owner Author

@sabernhardt sabernhardt May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style tag adds padding specifically for the header with block themes, so it should line up with the multisite wp-activate and wp-signup forms instead of touching the edge. I used :where() so a stylesheet could override that easily.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be a small amount of space instead, such as 1em.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant